﻿﻿﻿@extends('admin.Default')
@section('type')
    <!-- Data Tables -->
    <link href="{{ asset('myadmin/css/plugins/summernote/summernote.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/summernote/summernote-bs3.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/dropzone/basic.css') }}" rel="stylesheet">
    <link href="{{ asset('myadmin/css/plugins/dropzone/dropzone.css') }}" rel="stylesheet">
@stop
@section('content')
    <style type="text/css">
        body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";font-size:14px;}
        #l-map{height:300px;width:50%;}
        #r-result{width:100%;}
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=keXdM18CTQm5jrHeydPispemtrz5Y00v"></script>
    <div class="col-md-8" style="margin-top:50px;margin-left:330px;">
        <form method="post" action="/admin/super/{{ $list->id }}" name="upsuper" id="upsuper">
            <input type='hidden' name='_token' value='{{ csrf_token() }}'>
            <input type="hidden" name="id" class="form-control" value="{{ $list->id }}"  >
            <input type="hidden" name="ip" class="form-control" value="127.0.0.1"  >
            <input type='hidden' name='_method' value="PUT">
            {{--可以不写？？--}}
            <div class="form-group row">
                <label class="col-sm-2 control-label">账 &nbsp; &nbsp; &nbsp; 号：</label>
                <div class="col-sm-6">
                    <input type="text" name="username" class="form-control" value="{{ $list->username }}" disabled >
                    <input type="hidden" name="username" class="form-control" value="{{ $list->username }}"  >
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">新 密　码：</label>
                <div class="col-sm-6">
                    <input type="password" name="password" class="form-control"  placeholder="密码">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">确认密码：</label>
                <div class="col-sm-6">
                    <input type="password" name="pwd" class="form-control"  placeholder="确认密码"  onblur="pass(this);">
                </div>
            </div>

            <div class=" form-group row">
                <div class="form-group">
                    <label class="col-sm-2 control-label">等 &nbsp; &nbsp; &nbsp; 级：</label>
                    <div class="col-sm-10">
                        <select  name="level" id="level" class="col-sm-7" style="padding:6px 12px; ">
                            <option value="1" @if ($list->level == 1)  selected    @endif >普通管理员</option>
                            <option value="2"  @if ($list->level == 2)  selected    @endif>超级管理员</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 control-label">状态：</label>
                <div class="col-sm-4">
                    <label class="radio-inline">
                        <input type="radio" @if ($list->status == 1)  checked    @endif value="1" id="optionsRadios1" name="status">正常</label>
                    <label class="radio-inline">
                        <input type="radio" value="2" @if ($list->status == 2)  checked    @endif id="optionsRadios2" name="status">冻结</label>
                </div>
            </div>

            <button class="btn btn-primary" type="button" onclick="updatesuper()" style="margin-left: 200px;"><strong>提交</strong></button>
            <button class="btn btn-primary" type="reset"><strong>重置</strong></button>
        </form>
    </div>
@stop
@section('script')
    <!-- SUMMERNOTE -->
    <script src="{{ asset('myadmin/js/plugins/summernote/summernote.min.js') }}"></script>
    <script src="{{ asset('myadmin/js/plugins/summernote/summernote-zh-CN.js') }}"></script>
    <script src="{{ asset('myadmin/js/plugins/dropzone/dropzone.js') }}"></script>
    <script src="{{ asset('tools/form-builder/beautifyhtml.js') }}"></script>
    <script src="{{ asset('myadmin/js/jquery.md5.js') }}"></script>
    <script>
        function pass(bn){
            var pwd = $(bn).val();
            var password = $("input[name=password]").val();

            if(pwd == ""){
                alert("确认密码不能为空！");
            }else{
                if(pwd != password){
                    alert("两次密码不一致！");
                }
            }

        }

        function updatesuper() {
            var id = $("input[name=id]").val();
            var method = $("input[name=_method]").val();
            var username = $("input[name=username]").val();
            var password =$.md5($("input[name=password]").val());
            var pass = $("input[name=pwd]").val();
            var pstatus=$("input[type=radio]:checked").val();
            var level=$("#level").val();
            if (username == '' || password == '' || pass == '') {
                alert("请将信息填写完整！");
            }else{
                $('#upsuper').submit();
            }
        }
    </script>

    <script>
        $(document).ready(function () {

            $('.summernote').summernote({
                lang: 'zh-CN'
            });

        });
    </script>
@stop
